/*******************************************************************************
 * FILE			FreePhotoBooth.h
 * AUTHOR		John Paul Swaynos
 * DESCRIPTION
 * This is the main header file which contains include's for necessary 
 * libraries for the applicaiton, as well as some definitions which are used 
 * throughout the applicaiton. 
******************************************************************************/
#pragma once
#include <winsock2.h> // For opening sockets in Windows
#include <ws2tcpip.h> // ......
#include <Windows.h>
#include <vfw.h>
#include <iostream>	 // Primarily for modifying strings
#include <GdiPlus.h> // For image transformations
#include <iostream>
#include <fstream>
#include "Mode.h"
#include "PBDataStruct.h"
#include "wcomm.h"
#include "resource.h"

// Window Mode Definitions
#define		EASYMODE			1
#define		PHOTOMODE			2
#define		PRINTERMODE			3
// Menu Item's Definitions
#define     ID_EASYMODE        	1000
#define     ID_PHOTOMODE       	1001
#define     ID_PRINTERMODE     	1002
#define		ID_CAMERA			1003
#define		ID_PRINTER			1004
#define		ID_SAVING			1005
#define		ID_IPSETTINGS		1006
#define		ID_DELAYTIME		1007
// Button Defintions
#define		BUTTON_GO			2000
#define		BUTTON_ONE			2001
#define		BUTTON_TWO			2002
#define		BUTTON_FOUR			2003
#define		BUTTON_QUERY		2004
#define		BUTTON_PRINT		2005
#define		BUTTON_NEXT			2006
#define		BUTTON_ACTION		2007

// Port # definition
#define		DEFAULT_PORT		20777

using namespace Gdiplus;

LRESULT CALLBACK EasyModeProc (HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK PhotoModeProc (HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK PrinterModeProc (HWND, UINT, WPARAM, LPARAM);

/*******************************************************************************
 * STRUCT		ImageProcData
 * AUTHOR		John Paul Swaynos
 * DESCRIPTION
 * This struct stores two pieces of data that are used in the ImageProc 
 * function. The first piece of data is the numberOfShots that will be taken
 * and the second piece of data indicates which mode the program should grab
 * the image from.
******************************************************************************/
typedef struct ImageProcData {
    int numberOfShots;
    int mode;
} IMAGEPROCDATA, *PIMAGEPROCDATA;

void InsertMyMenu(HWND hwnd);
int GetEncoderClsid(const WCHAR* format, CLSID* pClsid);
void ConnectWebcam(int mode);
Bitmap* GrabBitmap(int mode);
Bitmap* ProcessBitmaps( Bitmap* bitmaps[], int numOfShots ); 
DWORD WINAPI ImageProc( LPVOID lpParam );
void PrintBitmap(Bitmap* file);
void LoadImages();
void SaveBitmap(Bitmap* file, int mode);
char* GetMySystemTime();
char* GetLocalDirectory();
char* GetFileName(int mode);
HANDLE StartServer();
DWORD WINAPI ServerProc( LPVOID lpParam );
BOOL CALLBACK IPProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam);
BOOL CALLBACK DelayTimeProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam);